package com.triones.ljr.controller.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.triones.ljr.entity.dto.OvertEnterpriseDO;
import com.triones.ljr.entity.vo.OvertDeptVO;
import com.triones.ljr.entity.vo.OvertEnterpriseVO;
import com.triones.ljr.service.OvertService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * api - 企业公开
 *
 * @Author: triones
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/overt")
public class ApiOvertController extends BaseController {

    private final OvertService overtService;

    /**
     * 部门列表
     */
    @GetMapping("/dept/list")
    public R<List<OvertDeptVO>> overtDeptList(String keyword) {
        return R.ok(overtService.selectDeptAll(keyword));
    }

    /**
     * 企业列表（分页）
     */
    @GetMapping("/enterprise/pageList")
    public TableDataInfo<OvertEnterpriseVO> pageList(OvertEnterpriseDO dto, PageQuery pageQuery) {
        return overtService.enterprisePageList(dto, pageQuery);
    }

    /**
     * 搜素 - 企业列表
     */
    @GetMapping("/query/enterprise/list")
    public R<List<OvertEnterpriseVO>> queryList(String keyword) {
        return R.ok(overtService.queryList(keyword));
    }
}
